package com.example.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import java.util.Collection;

/*
 *  @author 雨安
 *  类名： LoginUser
 *  创建时间：2024/3/18
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class LoginUser implements UserDetails {

    //自己的users对象
    private AxdRiskUser axdRiskUser;

    //返回权限信息
    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return null;
    }

    //获取密码
    @Override
    public String getPassword() {
        return axdRiskUser.getPassword();
    }

    //获取账号
    @Override
    public String getUsername() {
        return axdRiskUser.getUserName();
    }

    //判断没过期
    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    //是否
    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    //是否超时
    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    //是否可用
    @Override
    public boolean isEnabled() {
        return true;
    }
}
